<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .outer{
            width: 300px;
            height: 300px;
            background: rebeccapurple;
            
        }
        .center{
            width: 200px;
            height: 200px;
            background: red;
            position: fixed;
            left: 50px;
            top: 50px;
        }
        .inner{
            width: 100px;
            height: 100px;
            background: tan;
            display: flex;
            position: absolute;
            top: 50px;  
            left: 50px;         

        }

    </style>
</head>
<body>
    
    <div class="outer">
        <div class="center">
            <div class="inner"></div>
        </div>
    </div>

    <script>

        var outer = document.querySelector('.outer')
        var center = document.querySelector('.center')
        var inner = document.querySelector('.inner')

        outer.onclick=function(){console.log("outer");}
        center.onclick=function(){console.log("center");}
        inner.onclick=function(e){
            // 阻止事件传播
            e.stopPropagation()
            console.log("inner");}

    </script>

</body>
</html>